package com.ruoyi.Test;

import lombok.Getter;
import org.springframework.web.bind.annotation.*;
import java.util.HashSet;
import java.util.Set;

import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;

import java.util.List;


@RestController
public class CourseController {

    @RequestMapping("/courseSet")
    public Set<String> getCourseSet() {
        Set<String> courses = new HashSet<>();
        courses.add("数学");
        courses.add("语文");
        courses.add("英语");
        courses.add("物理");
        return courses;
    }

    @RequestMapping("/scoreMap")
    public Map<String, Integer> getScoreMap() {
        Map<String, Integer> scores = new HashMap<>();
        scores.put("张三", 88);
        scores.put("李四", 92);
        scores.put("王五", 77);
        return scores;
    }

    @RequestMapping("/studentMapWithList")
    public Map<String, List<Student>> getStudentMapWithList() {
        Map<String, List<Student>> classStudentsMap = new HashMap<>();

        List<Student> class1Students = new ArrayList<>();
        class1Students.add(new Student("张三", 18));
        class1Students.add(new Student("李四", 20));
        classStudentsMap.put("班级1", class1Students);

        List<Student> class2Students = new ArrayList<>();
        class2Students.add(new Student("王五", 22));
        class2Students.add(new Student("赵六", 24));
        classStudentsMap.put("班级2", class2Students);

        return classStudentsMap;
    }
}

// 定义Student类
@Getter
class Student {
    // Getter和Setter方法
    private String name;
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
